package com.xmkj.bearbiz.member;

import android.content.Context;
import android.content.Intent;
import android.view.View;

import com.common.BearBean.MemberListBean;
import com.common.widget.recyclerview.refresh.adapter.CommonAdapter;
import com.common.widget.recyclerview.refresh.adapter.ViewHolder;
import com.xmkj.bearbiz.R;

import java.util.List;

/**
 * Create by leo
 * 创建日期：2018/6/15
 * 描述：
 */

public class MemberListAdapter extends CommonAdapter<MemberListBean.ListsEntity> {
    String deptcode;

    public MemberListAdapter(Context context, List<MemberListBean.ListsEntity> data, String deptcode) {
        super(context, data);
        this.deptcode = deptcode;

    }

    @Override
    protected void convert(ViewHolder holder, final MemberListBean.ListsEntity item, int position) {
        holder.getParentView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(mContext, MemberInfoDetailAcitivity.class);
                intent.putExtra(MemberInfoDetailAcitivity.DEPTCODE,deptcode);
                intent.putExtra(MemberInfoDetailAcitivity.VIPCARDID,item.vipcardid+"");
                mContext.startActivity(intent);
            }
        });
        holder.setImageStr(R.id.iv_img, item.face);
        holder.setText(R.id.tv_name, item.nickname);
        holder.setText(R.id.tv_chuzhi, "储值余额：" + item.ssmoney);
        holder.setText(R.id.tv_contum, "消费总额：" + item.salemoney);
        holder.setText(R.id.tv_jifen, "积分：" + item.point);
        holder.setText(R.id.tv_consume_times, "消费次数：" + item.salenum);


    }

    @Override
    protected int getItemViewLayoutId(int position, MemberListBean.ListsEntity item) {
        return R.layout.item_member_list;
    }
}
